package entity.innerClass.lianxi.demo03;

import java.util.Arrays;
import java.util.Comparator;

public class MainTest {
    public static void main(String[] args) {
        Student stu = new Student("张三",23);
        Student stu1 = new Student("李四",25);
        Student stu2 = new Student("王五",36);
        Student stu3 = new Student("超六",12);
        Student[] st = {stu,stu1,stu2,stu3};
        Arrays.sort(st,(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return o1.getAge()-o2.getAge();
            }
        }));
        System.out.println(Arrays.toString(st));
    }
}
